import java.util.LinkedList; class demo { public static void main(String args[]) { LinkedList linkedList=new LinkedList(); linkedList.add("Amit Jain"); linkedList.add("Sumit Kumar"); linkedList.add("Raja Rathi"); linkedList.add("Gopal Pandey"); System.out.print(linkedList+"\n"); linkedList.add(1,"Raj Kumar"); System.out.print(linkedList); } }
[Amit Jain, Sumit Kumar, Raja Rathi, Gopal Pandey] [Amit Jain, Raj Kumar, Sumit Kumar, Raja Rathi, Gopal Pandey]